package com.demo2.dao;

import com.demo2.entity.Product;
import com.demo2.util.OrderUtil;
import com.demo2.util.PageUtil;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface ProductMapper {
    //    List<Product> select(@Param("product") Product product, @Param("product_isEnabled_array") Byte[] product_isEnabled_array, @Param("orderUtil") OrderUtil orderUtil, @Param("pageUtil") PageUtil pageUtil);
    @Select("select * from product where product_id = #{id}")
    public Product getById(Integer id);

    @Insert("insert into product (product_id, product_name, product_title, product_price, " +
            "product_sale_price, product_create_date, product_category_id, product_isEnabled, " +
            "product_sale_count, product_review_count) values(#{product.product_id}, #{product.product_name}, " +
            "#{product.product_title}, #{product.product_price}, #{product.product_sale_price}, " +
            "#{product.product_create_date}, #{product.product_category.category_id}, #{product.product_isEnabled}, " +
            "#{product.product_sale_count}, #{product.product_review_count})")
    public int add(@Param("product") Product product);

//    public Integer add(Product product);

    Integer updateOne(@Param("product") Product product);


    int updateUser(Product product);

    int deleteList(ArrayList<Integer>  idList);
}
//    Integer insertOne(@Param("product") Product product);